<div class="modal fade bs-modal-md" id="modelContent">
	<div class="modal-dialog modal-md">
        <div class="modal-content"></div>
    </div>
</div> 
<div class="portlet box green">
	<div class="portlet-title">
	    <div class="caption"><i class="fa fa-cog"></i>查询内容 </div>
		<div class="tools">
			<a href="javascript:;" class="collapse right" data-original-title="" title=""> </a>
			<!-- <a href="" class="fullscreen" data-original-title="" title=""> </a> -->
    	</div>
    	<div class="actions">
			<a href="javascript:;" class="btn white btn-sm ajax-search"><i class="fa fa-search"></i> 查询 </a>
			<a href="javascript:;" class="btn white btn-sm search-reset"><i class="fa fa-eraser"></i> 清除 </a>
		</div>
	</div>
	<div class="portlet-body form">
	   	<form action="/clientprice/list" class="form-horizontal" method="get" id="searchForm" onsubmit="return false">
			<div class="form-body">
				<div class="row">
					<div class="form-group">
						<div class="col-md-3">
							<label class="col-md-4 control-label">客户：</label>
							<div class="col-md-8">
								<select name="companyId" class="form-control">
									<option value="" selected >--请选择--</option>
									#foreach($company in $!companyList)
									<option #if($!companyId ==$!company.id) selected #end value="$!company.id">$!company.name</option>
									#end
								</select>
							</div>
						</div>
						<div class="col-md-3">
							<label class="col-md-4 control-label">货品：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" name="productName" placeholder="输入货品名称或编码" value="$!productName">
							</div> 
						</div>
						<div class="col-md-3">
							<label class="col-md-4 control-label">SKU：</label>
							<div class="col-md-8">
						    	<input type="text" class="form-control" placeholder="输入货品SKU编码" name="skuCode" value="$!skuCode">
							</div>
						</div>
						<div class="col-md-3">
							<label class="col-md-4 control-label">分类：</label>
							<div class="col-md-8" >
 								<select name="categoryId" class="form-control">
 									<option value="">请选择</option>
 									#foreach($category in $!categoryList)
 										<option #if($!category.id == $!categoryId) selected #end   value="$!category.id">$!category.name</option>
 									#end
 								</select>
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-md-3">
							<label class="control-label col-md-4">品牌</label> 
							<label class="col-md-8">
								<select class="form-control" name="brandId">
								<option value="">请选择</option>
								#foreach($brand in $!brandList)
									<option  #if($!brand.id == $!brandId ) selected #end   value="$!brand.id">$!brand.name</option>
								#end
								</select>
							</label>
						</div>					
					
						<div class="col-md-3">
							<label class="control-label col-md-4">议价：</label>
							<label class="col-md-8">
								<select class="form-control" name="quotatiou">
									<option value="" selected >--请选择--</option>
									 
									<option  #if($!quotatiou != "no_quotatiou" && $!quotatiou != "yes_quotatiou") selected  #end id="holel" >全部</option>
								    
									<option #if($!quotatiou == "no_quotatiou") selected #end  value="no_quotatiou">未议价</option>
									<option  #if($!quotatiou == "yes_quotatiou") selected #end value="yes_quotatiou">已议价</option>
								
								</select>
							</label>
						</div>
					
					
					</div>
	    		</div>
			</div>
		</form>
	</div>
</div>
<div class="portlet box green">
    <div class="portlet-title">
		<div class="caption"><i class="fa fa-cogs"></i>数据列表</div>
		<div class="tools"><a href="javascript:;" class="collapse" data-original-title="" title=""> </a></div>
		<div class="actions">
			 <div class="btn-group " >
				<button type="button" class="btn white btn-sm " data-toggle="dropdown"> 
					<i class="fa fa-cloud-download"></i> 导出
				</button>
				<ul class="dropdown-menu pull-right" role="menu">
					<li>
						<a href="javascript:;" class="export-tab"> <i class="fa fa-cube"></i> 指定商品</a>
					</li>
					<li>
						<a href="javascript:;" class="export-tab"> <i class="fa fa-cubes"></i> 全部商品</a>
					</li>
				</ul>
			</div>
		</div>
    </div>
    <div class="portlet-body">
    	       <div class="form-group">
					<div class="alert alert-warning">
						<strong> 注：</strong>
						 1.设置的阶梯价格不允许高于最后报价的报价单价格。
					</div>
				</div>
    	<div class="tabbable-line ">
	    	<div class="dataTables_wrapper no-footer">
				<div class="table-scrollable">
					 <table class="table table-striped table-bordered table-hover  " id="tableCategory">
						  <thead>
							<tr>
								<th>货品编码</th>
								<th>SKU</th>
								<th>货品名称</th>
								<th>规格</th>
								<th>分类</th>
								<th>品牌</th>
								<th>协议价</th>
								<th>库存	</th>
								<th>总销量</th>
								<th>标签</th>
								
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							#foreach($sku in $!skuPage.result)
							#set($product = $!sku.product)
							#set($inventory = $!inventorymap.get($sku))
							#set($price = $!priceMap.get($sku))
							<tr>
								<td>$!product.code</td>
								<td>$!sku.code</td>
								
							<td>	
							<div style="display: inline-block;margin-left: 10px">
								<p style="margin: 0"><a href="$!portalHostDomain/product/$!product.id" title="$item.name" target="_blank">$product.name</a></p>
							</div>
						     </td>						     
								<td>$!sku.attrValueNames</td>
								<td>$!product.category.name</td>
								<td>$!product.brandName</td>
								<td>
								
									<font color='red'>
								   $price
								   </font>
								   
							#set($vipPrice=($!sku.companyVipPrice)*10) 
								</td> 
								<!--$!product.vipPrice-->
								<td>$!sku.inventory</td>
								<td>$!product.salesNum</td>
								<td>$!product.lables</td>
							<!-- 	<td><a href="#">查看</a></td> -->
							<!-- 	<td><a href="#">阶梯价格</a></td> -->
								<td><a class="btn green btn-outline btn-sm ajax-model-get" data-toggle="modal" href="#modelContent" thref="/clientprice/TieredPrice?productCode=$!product.code&companyId=$!companyId&companyVipPrice=$!sku.vipPriceFirst&skuCode=$!sku.inventory"> 
									    <i class="fa fa-edit"></i>  阶梯价格
								    </a>
								</td>
							</tr>
							#end
						</tbody>
					</table>
				</div>
				
				
				#set($page= $!skuPage)
				#set($pageUrl="/clientprice/list?$!queryString&pageNo=")
				#parse("_page.htm")
				
			</div>
			<form id="downfile" action="" class="hide" method="POST">
				<input type="hidden" name="companyId"   value="$!companyId">
				<button type="submit"></button>
			</form>
		</div>
    </div>
</div>
<script type="text/javascript">
	var userName="$!loginUser.username";

	ComponentsSelect2.initWithSearch();
	   
     $("input[name=id]").focus();
     
	 var pageContentBody = $('.page-content .page-content-body');
     
 
     /**
     *
     * excel 导出
     */
    $(".export-tab").click(function(){
    	
 		    $("#downfile").attr("action","/clientprice/exportExcel");
 			$("#downfile").submit();
   	 
    })
</script>
